<html xmlns:th="http://www.thymeleaf.org">
<html>
  <head>
    <meta charset="UTF-8">
    <title>添加公告</title>
	<meta name="pragma" content="no-cache">
	<meta name="cache-control" content="no-cache">
	<meta name="content-type" content="text/html;charset=UTF-8">
	<meta name="expires" content="0">
	  <link href="../../../../static/easyui/themes/insdep/easyui.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/easyui/themes/insdep/easyui_animation.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/easyui/themes/insdep/easyui_plus.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/easyui/themes/insdep/insdep_theme_default.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/easyui/themes/insdep/icon.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/easyui/themes/color.css" rel="stylesheet" type="text/css">
	  <link href="../../../../static/ztree/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" >
	  <link href="../../../../static/css/common.css" rel="stylesheet" type="text/css" >
	  <script type="text/javascript" src="../../../../static/jquery/jquery.min.js"></script>
	  <script type="text/javascript" src="../../../../static/easyui/jquery.easyui.min.js"></script>
	  <script type="text/javascript" src="../../../../static/easyui/themes/insdep/jquery.insdep-extend.min.js"></script>
	  <script type="text/javascript" src="../../../../static/ztree/jquery.ztree.all.min.js"></script>
	  <script type="text/javascript" src="../../../../static/easyui/easyui-lang-zh_CN.js"></script>
	  <script type="text/javascript" src="../../../../static/kindeditor/kindeditor-all-min.js"></script>
  </head>
  <style type="text/css">
.myselect{
	height:30px;
	width:80%;
}
</style>
  <body style="width:100%;max-width:600px;padding:10px 30px;">
  <form id="form" method="post">
	<strong>基本信息</strong>
	<section class="info-section">
			<table id="tb">
				<tr>
				<td class="text-title"> 标题：</td>
					<td>					
					    <input type="text" style="width:80%;" required="required" name="title" th:value="${tbCrmAnnouncement.title}" class="easyui-textbox theme-textbox-radius" >
					    <input type="hidden" name="id" th:value="${tbCrmAnnouncement.id}">
						<!--!!!!!!!!!!!!!!!!!!	从Session会话中获取登录者的ID-->
						<input type="hidden" name="userId" th:value="${session.user.id}">
						<!--<input type="hidden" name="updatetime"  value="${announcementVO.updatetime }" >
						<input type="hidden" name="createtime"  value="${announcementVO.createtime }" >	 -->
					</td>
			     </tr>			     
				<tr>
				    <td class="text-title"> 颜色：</td>
					<td>					
					    <input type="text" style="width:80%;" name="color" th:value="${tbCrmAnnouncement.color}" class="easyui-textbox theme-textbox-radius" >
					</td>
			     </tr>
			     <tr>
				    <td class="text-title"> 排序编号：</td>
					<td>
					   <input type="number" style="width:80%;" name="orderId" required="required"  th:value="${tbCrmAnnouncement.orderId }" class="easyui-textbox theme-textbox-radius" >
					</td>
			     </tr>			 			         
			     <tr>
					 <td class="text-title"> 是否显示：</td>
					 <td>
						<input type="radio" name="isshow" value="1" checked />是
					    <input type="radio" name="isshow"  value="0" th:checked="${tbCrmAnnouncement.isshow==0?true:false}" />否
					 </td>
				 </tr>
				 <tr>
					<td class="text-title">  是否发布：</td>
					<td>        
					    <input type="radio" name="status"  value="1" checked/>是
					    <input type="radio" name="status" value="0" th:checked="${tbCrmAnnouncement.status==0?true:false}"/>否
					</td>
				</tr>
				<tr>
					<td class="text-title">通知部门：</td>
					<td class="text-content">
						<select  class="myselect" name="department" >
							<option value="-1">请选择部门</option>
							<option th:each="department:${tbCrmDepartment}" th:selected="${tbCrmAnnouncement.department==department.name?true:false}" th:value="${department.name}" th:text="${department.name}"></option>
						</select>
					</td>
				</tr>
                <tr>
					<td class="text-title">内容</td>
					<td class="text-content">
						<textarea name="content" rows="10" style="width:80%;" th:text="${tbCrmAnnouncement.content}"></textarea>
					</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: center;margin-top: 10px;">
						<a href="javascript:void(0);" id="saveBtn" class="easyui-linkbutton button-primary">保存</a> 
						<a href="javascript:void(0);" id="resetBtn" class="easyui-linkbutton button-danger">重置</a>
					</td>
				</tr>
			</table>
	  </section>
   </form>

	<script type="text/javascript">
		$(function() {
			//重置按钮
			$("#resetBtn").on("click",function(event){
				$("#form").form("reset");
			});
			
			//为保存按钮添加事件
			$("#saveBtn").on("click",function(event){
				$("#form").form("submit",{
					url:"Announcement_saveOrUpdate",
					onSumbit : function(){
						//调用easyui中form对象的validate方法对表单中数据进行校验，该方法返回boolean值，如果为false会阻止表单提交
						return $("#form").form("validate");
					},
					success : function(data){
					var obj = eval("("+data+")");
						if(obj.success==true){
							$.messager.alert("提示",obj.msg,"info",function (){
								parent.closeTopWindow();
							});

						}else{
							$.messager.alert("警告",obj.msg,"info");
						}
					}
				});
			});
			
		});
		//给部门添加下拉框选项
			/*$(function (){
				$.post(
						"Department_findAll.do",
						function(data){
							if(data){
								var departmentId = "${tbCrmAnnouncement.department}";
								$.each(data.data,function(index,obj){
									$(".myselect").append(
									"<option value="+obj.name+">"+obj.name+"</option>")
								})
							}
						},"json"
				)
			});*/
	</script>
</body>
</html>
				
